<?php
//Config JQuery Library Location
/*
$jquery_url = 'http://withelper.oss-cn-hangzhou.aliyuncs.com/jquery/jquery.js';
$jquery_moblie_url = 'http://withelper.oss-cn-hangzhou.aliyuncs.com/jquery/jquery.mobile-1.4.2.min.js';
$jquery_mobile_css_url = 'http://withelper.oss-cn-hangzhou.aliyuncs.com/jquery/css/themes/default/jquery.mobile-1.4.2.min.css';
$moment_url = 'http://withelper.oss-cn-hangzhou.aliyuncs.com/js/moment.min.js';
$md5_url = 'http://withelper.oss-cn-hangzhou.aliyuncs.com/js/jquery.md5.js';
*/

require($_SERVER["DOCUMENT_ROOT"]."/common/get_key.php");
require($_SERVER["DOCUMENT_ROOT"]."/common/config.php");

$jquery_url = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js';
$jquery_moblie_url = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.1/jquery.mobile.min.js';
$jquery_mobile_css_url = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.1/jquery.mobile.min.css';
$moment_url = 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js';
$md5_url = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js';
?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title><?php echo $title;?></title>
	
	<link rel="shortcut icon" href="favicon.ico">
	
<?php
if(isset($jquery_mobile)){
	echo '<link rel="stylesheet"  href="'.$jquery_mobile_css_url.'">';
}
if(isset($min_css)){
	echo '<link rel="stylesheet"  href="../min/index.php?g='.$min_css.'">';
}
if(isset($jquery)){
	echo '<script type="text/javascript" src="'.$jquery_url.'"></script>';
}
if(isset($jquery_mobile)){
	echo '<script type="text/javascript" src="'.$jquery_moblie_url.'"></script>';
}
if(isset($moment)){
	echo '<script type="text/javascript" src="'.$moment_url.'"></script>';
}
if(isset($md5)){
	echo '<script type="text/javascript" src="'.$md5_url.'"></script>';
}

echo '<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>';

$timestamp = time();
$nonceStr = md5(time()."itjesse");
$getKey = new get_key($appid, $appsecret, $_SERVER["DOCUMENT_ROOT"]);
$jsapi_ticket = $getKey->get_jsapi_ticket();
$url = $base_url . $url;

$string = "jsapi_ticket={$jsapi_ticket}&noncestr={$nonceStr}&timestamp={$timestamp}&url={$url}";
$signature = sha1($string);
?>

	<script>
		wx.config({
			debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
			appId: '<?php echo $appid;?>', // 必填，公众号的唯一标识
			timestamp: <?php echo $timestamp;?>, // 必填，生成签名的时间戳
			nonceStr: '<?php echo $nonceStr;?>', // 必填，生成签名的随机串
			signature: '<?php echo $signature;?>',// 必填，签名，见附录1
			jsApiList: [
				'checkJsApi',
				'onMenuShareTimeline',
				'onMenuShareAppMessage',
				'onMenuShareQQ',
				'onMenuShareWeibo',
				'hideMenuItems',
				'showMenuItems',
				'hideAllNonBaseMenuItem',
				'showAllNonBaseMenuItem',
				'translateVoice',
				'startRecord',
				'stopRecord',
				'onRecordEnd',
				'playVoice',
				'pauseVoice',
				'stopVoice',
				'uploadVoice',
				'downloadVoice',
				'chooseImage',
				'previewImage',
				'uploadImage',
				'downloadImage',
				'getNetworkType',
				'openLocation',
				'getLocation',
				'hideOptionMenu',
				'showOptionMenu',
				'closeWindow',
				'scanQRCode',
				'chooseWXPay',
				'openProductSpecificView',
				'addCard',
				'chooseCard',
				'openCard'
			] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
		});
	</script>
	<script type="text/javascript" src="../common/wechat.js"></script>
<?php
if(isset($min_js)){
	echo '<script type="text/javascript" src="../min/index.php?g='.$min_js.'"></script>';
}
?>
</head>